package com.rajaev.dtu.tractor.domain.repository.mysql;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserCustomerDao {

    @Insert({
            "<script>",
            "insert into t_user_customer (user_id,customer_id) values ",
            "<foreach item='customerId'  collection='customerIds' separator=',' >",
            "(#{userId},#{customerId})",
            "</foreach>",
            "</script>"
    })
    void insert(@Param("customerIds") List<Integer> customerIds,@Param("userId")  Integer userId);

    @Delete({
            "delete from t_user_customer where user_id = #{userId}"
    })
    void delete(Integer userId);




}
